package com.xiaoshuidi.cloud.module.contract.service.contract.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xiaoshuidi.cloud.module.contract.dal.dataobject.contract.ContractTaxRateDO;
import com.xiaoshuidi.cloud.module.contract.dal.mysql.contract.ContractTaxRateMapper;
import com.xiaoshuidi.cloud.module.contract.service.contract.ContractTaxRateService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
@Slf4j
public class ContractTaxRateServiceImpl extends ServiceImpl<ContractTaxRateMapper, ContractTaxRateDO> implements ContractTaxRateService {

    @Resource
    private ContractTaxRateMapper contractTaxRateMapper;

    /**
     * 查询
     * @param apartmentId
     * @return
     */
    @Override
    public ContractTaxRateDO getContractTaxRate(Long apartmentId) {
        LambdaQueryWrapper<ContractTaxRateDO> wrapper = Wrappers.lambdaQuery();
        wrapper.eq(ContractTaxRateDO::getApartmentId,apartmentId);
        ContractTaxRateDO contractTaxRateDO = contractTaxRateMapper.selectOne(wrapper);
        return contractTaxRateDO;
    }
}
